home *** CD-ROM | disk | FTP | other *** search
/ Learn Microsoft Visual Basic 6.0 Now / Learn Microsoft Visual Basic 6.0 Now (Microsoft Press)(X03-58607)(1998).ISO / media / chap04 / b04d005.cc2 < prev    next >
Text File  |  1998-06-07  |  2KB  |  48 lines

  1. 0, In this demonstration you'll learn how 
  2. 2, to use variables with the InputBox and 
  3. 5, MsgBox functions. Variables are temporary 
  4. 8, storage containers in a program and the 
  5. 10, InputBox and MsgBox functions use 
  6. 13, variables to hold critical values as they 
  7. 16, work. The program I'll create is a simple 
  8. 18, utility that prompts you for your name and 
  9. 21, displays it on the form. First, I'll 
  10. 24, create a label object on the form to 
  11. 27, display the output. And I'll create a Command 
  12. 32, button to prompt the user for input. 
  13. 39, I'll set the Caption property of the 
  14. 41, Command button to Input Box to identify the 
  15. 44, dialog box that the function opens. Next, 
  16. 53, I'll write the program code that 
  17. 55, declares my variables and calls the InputBox 
  18. 58, and MsgBox functions. The first line uses 
  19. 67, the Dim keyword to declare two 
  20. 69, variables, Prompt and FullName. Prompt will 
  21. 73, contain the instructions for the InputBox 
  22. 75, function, and FullName will hold the 
  23. 78, user's name temporarily in the program. The 
  24. 85, third line displays an input box and 
  25. 87, assigns the information that comes back to 
  26. 89, the FullName variable. The event 
  27. 92, procedure then uses the MsgBox function to 
  28. 95, display the user's name in a small dialog 
  29. 97, box. The final program statement assigns 
  30. 102, the FullName variable to the Caption 
  31. 104, property of the Label1 object. When I close 
  32. 108, the Code window and run the program, 
  33. 112, Visual Basic displays my form in the 
  34. 115, programming environment. When I click the 
  35. 122, Command button, the InputBox function 
  36. 125, displays a dialog box prompting me for my name. 
  37. 128, I'll type my name and click the OK 
  38. 133, button to finalize my input. The MsgBox 
  39. 136, function displays it in a smaller dialog box 
  40. 140, and when I click OK, it appears in the 
  41. 143, label object on my form. All right, I 
  42. 146, admit this has been a pretty simple 
  43. 147, example, but hopefully it demonstrates the 
  44. 150, powerful potential of variables and dialog 
  45. 152, boxes in your programs. Together they 
  46. 154, form the core of your 
  47. 156, information-gathering capabilities.
  48. 158, END